#!/usr/bin/env python

def base_transform(num, base = 2):
    digits = '0123456789ABCDEF'
    if num < base:
        return digits[num]
    else:
        num, rem = divmod(num, base)
        return base_transform(num, base) + digits[rem]


if __name__ == "__main__":
    print(base_transform(27, 16))